Connect to VPN

# skip this. we don't depend on pipeline anymore
#Clone Pipelines Operator bundle source
#http://pkgs.devel.redhat.com/cgit/containers/openshift-pipelines-operator-prod-operator-metadata/
#Checkout the right branch e.g. "pipelines-1.3-rhel-8"

#Edit clusterserviceversion yaml to remove "replaces" statement
#Docker build the bundle
#Push the bundle

#$ podman build -t quay.io/wtam/pipelines-operator-bundle:v1.3.1 .
#$ podman push quay.io/wtam/pipelines-operator-bundle:v1.3.1
#(make quay.io/wtam/pipelines-operator-bundle repo public)
#record the sha for the next command: sha256:c40e603a88a45ec1909d9a4e135628a6fefbda0c08385c0304365d87025049fb

Since "oc adm catalog mirror" command does not honor ImageContentSourcePolicy, we need to edit the gitops operator CSV to add
sha to all the images in registry-proxy.engineering.redhat.com repo (e.g. registry-proxy.engineering.redhat.com/rh-osbs/openshift-gitops-1-gitops-rhel8-operator@sha256:424cc07966455490e86c1911346cb8447b61c04a3be2171213beba4f7dea21c0)

(clone url of the cgit repo ssh://wtam@pkgs.devel.redhat.com/containers/openshift-gitops-operator-bundle)
Clone and cgit gitops operator bundle
Edit CSV file to add sha to all images.

Update the operator image to replace tag with sha @sha256:9bf779a1ea95c90d84683484a260f1c89dbf3e73acfd09405798bfaf60c22d3e

Add relatedImages

spec:
  relatedImages:
  - name: argocd
    image: registry-proxy.engineering.redhat.com/rh-osbs/openshift-gitops-1-argocd-rhel8@sha256:4cbbd5f2267ee25b2d7465cc156d7c3360d1422e46348e8a4db225a8544f2045
  - name: applicationset
    image: registry-proxy.engineering.redhat.com/rh-osbs/openshift-gitops-1-applicationset-rhel8@sha256:6308d9ff5417a3d5f5a63209ccb42272b35b1f5c04c0f0c97fa6a395c385c44a    
  - name: kam
    image: registry-proxy.engineering.redhat.com/rh-osbs/openshift-gitops-1-kam-delivery-rhel8@sha256:e47dbbe01bdc2845e7c22acc7963b79ad9abd6528539e60d3e21ecb699923ca0
  - name: backend
    image: registry-proxy.engineering.redhat.com/rh-osbs/openshift-gitops-1-gitops-rhel8@sha256:7768d77bc9c8f5886091290eebd1ee13bf3e426ab413a7d753759ee3e885308e
  - name: redis
    image: registry.redhat.io/rhel8/redis-5@sha256:bbe1ee2913d69649f7630222681245b9ad94b74940974d58a64d8fe0a05d8b13
  - name: redis proxy
    image: registry.redhat.io/openshift4/ose-haproxy-router@sha256:2bde84d46bbba8f00718d994824dd7bd5a3db8f0b32c19d6d34efd1f4fef4fa7  
    
$ podman build -t quay.io/wtam/gitops-operator-bundle:v1.2.0 .
$ podman push quay.io/wtam/gitops-operator-bundle:v1.2.0
(record the sha)
sha256:961162b59950e1e6758292164ae56399eb54b25e6139c00499339f67ca0d5f29

!!! NOTE: the comma seperated list cannot have spaces.
!!! NOTE: make sure registry.redhat.io auth token is in ~/.docker/config.json
$ opm index add -b \
  quay.io/wtam/gitops-operator-bundle@sha256:961162b59950e1e6758292164ae56399eb54b25e6139c00499339f67ca0d5f29 \
  -t quay.io/wtam/test-index:v1.2.0 \
  --build-tool docker

$ docker push quay.io/wtam/test-index:v1.2.0 
or (if you used --build-tool podman)
$ podman push quay.io/wtam/test-index:v1.2.0 

(authfile has your quay.io auth token)
(make quay.io/wtam/gitops-operator-index public)
record the sha256:6b91e91c14ef7accd4446016b396ff2f6943b3a184ad61fa1d16b3d7e2278335